﻿using System.Windows;
using Microsoft.Phone.Controls;
using Daenet.WidgetLibrary;
using System;

namespace jQueryMobileSample
{
    public partial class MainPage : PhoneApplicationPage
    {
        public MainPage()
        {
            //In two lines instal your HTML5 app to WP7+.
            var wdgt = new WPWidgetLibrary();
            wdgt.InstalHTMLContent("HTML", new string[] 
                                                { "js/jQueryMobile/images", 
                                                   "SubContent/SubSubContent",
                                                    
                                                });

            InitializeComponent();

            this.Loaded += new RoutedEventHandler(MainPage_Loaded);
        }

void MainPage_Loaded(object sender, RoutedEventArgs e)
{
    //Navigate to initial page of the HTML app 
    webBrowser1.Navigate(new Uri("StartPage.htm", UriKind.Relative));
}

        /// <summary>
        /// We need to override hardware back key so that the first check 
        /// if the back works on out WebControl other view use hardware back functionality
        /// </summary>
        /// <param name="e"></param>
        protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)
        {
            var sss= webBrowser1.Source.ToString();
            if (sss != "StartPage.htm")
            {
                //Navigate to initial page of the HTML app 
                webBrowser1.Navigate(new Uri("StartPage.htm", UriKind.Relative));
                e.Cancel = true;
            }
        }

    }
}